Remove gtk_container_snapshot_child
authorTimm Bäder <mail@baedert.org>
Sat, 7 Jan 2017 16:02:20 +0000 (17:02 +0100)
committerTimm Bäder <mail@baedert.org>
Sat, 7 Jan 2017 16:19:30 +0000 (17:19 +0100)
Replace it with the already existing gtk_widget_snapshot_child.

18 files changed:
docs/reference/gtk/gtk4-sections.txt
gtk/gtkbbox.c
gtk/gtkcombobox.c
gtk/gtkcontainer.c
gtk/gtkcontainer.h
gtk/gtkfixed.c
gtk/gtkmodelbutton.c
gtk/gtknotebook.c
gtk/gtkpaned.c
gtk/gtkpopover.c
gtk/gtkrevealer.c
gtk/gtkstack.c
gtk/gtktoolbar.c
gtk/gtktreeview.c
gtk/gtkwidget.c
gtk/gtkwidget.h
gtk/gtkwidgetprivate.h
gtk/gtkwindow.c

index 324dde559dda5620e4bd56cb2ff15f1840e81894..220d5c31540493451614f191aee281d63ed54379 100644 (file)
@@ -735,7 +735,6 @@ gtk_container_child_notify
 gtk_container_child_notify_by_pspec
 gtk_container_forall
 gtk_container_propagate_draw
-gtk_container_snapshot_child
 gtk_container_get_focus_chain
 gtk_container_set_focus_chain
 gtk_container_unset_focus_chain
@@ -4650,6 +4649,7 @@ gtk_widget_set_opacity
 gtk_widget_list_action_prefixes
 gtk_widget_get_action_group
 gtk_widget_measure
+gtk_widget_snapshot_child
 
 <SUBSECTION>
 gtk_widget_get_path
index d44e62b5079b87d764f52a179e99aa4337d5bf9d..34c338aeafc99c09c72b3dc92b38d45e3a3ad3aa 100644 (file)
@@ -214,9 +214,9 @@ static void
 gtk_button_box_snapshot_forall (GtkWidget *child,
                                 gpointer   snapshot)
 {
-  gtk_container_snapshot_child (GTK_CONTAINER (gtk_widget_get_parent (child)),
-                                child,
-                                snapshot);
+  gtk_widget_snapshot_child (gtk_widget_get_parent (child),
+                             child,
+                             snapshot);
 }
 
 static gboolean
index 4da7cbaca6313280d2d078d830e55f535d4a3420..49a9f364836050eb2c2c75939eb4701cde110c1f 100644 (file)
@@ -474,8 +474,8 @@ gtk_combo_box_render (GtkCssGadget *gadget,
   GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
   GtkComboBoxPrivate *priv = combo_box->priv;
 
-  gtk_container_snapshot_child (GTK_CONTAINER (widget),
-                                priv->box, snapshot);
+  gtk_widget_snapshot_child (widget,
+                             priv->box, snapshot);
 
   return FALSE;
 }
index 39fc7c44e3ee3d5075602571eec8e44699347029..8968983886d940e3fea02ecac689207e0d30510a 100644 (file)
@@ -3067,9 +3067,9 @@ static void
 gtk_container_snapshot_forall (GtkWidget *child,
                                gpointer   snapshot)
 {
-  gtk_container_snapshot_child (GTK_CONTAINER (_gtk_widget_get_parent (child)),
-                                child,
-                                snapshot);
+  gtk_widget_snapshot_child (_gtk_widget_get_parent (child),
+                             child,
+                             snapshot);
 }
 
 static void
@@ -3221,45 +3221,6 @@ gtk_container_propagate_draw (GtkContainer *container,
   cairo_restore (cr);
 }
 
-/**
- * gtk_container_snapshot_child:
- * @container: a #GtkContainer
- * @child: a child of @container
- * @snapshot: $GtkSnapshot as passed to the container. In particular, no
- *   calls to gtk_snapshot_translate_2d() should have been applied by the
- *   parent.
- *
- * When a container receives a call to the snapshot function, it must send
- * synthetic #GtkWidget::snapshot calls to all children. This function
- * provides a convenient way of doing this. A container, when it receives
- * a call to its #GtkWidget::snapshot function, calls
- * gtk_container_snapshot_child() once for each child, passing in
- * the @snapshot the container received.
- *
- * gtk_container_snapshot_child() takes care of translating the origin of
- * @snapshot, and deciding whether the child needs to be snapshot. It is a
- * convenient and optimized way of getting the same effect as calling
- * gtk_widget_snapshot() on the child directly.
- **/
-void
-gtk_container_snapshot_child (GtkContainer      *container,
-                              GtkWidget         *child,
-                              GtkSnapshot       *snapshot)
-{
-  int x, y;
-
-  g_return_if_fail (GTK_IS_CONTAINER (container));
-  g_return_if_fail (GTK_IS_WIDGET (child));
-  g_return_if_fail (_gtk_widget_get_parent (child) == GTK_WIDGET (container));
-  g_return_if_fail (snapshot != NULL);
-
-  gtk_container_get_translation_to_child (container, child, &x, &y);
-
-  gtk_snapshot_translate_2d (snapshot, x, y);
-  gtk_widget_snapshot (child, snapshot);
-  gtk_snapshot_translate_2d (snapshot, -x, -y);
-}
-
 /**
  * gtk_container_get_path_for_child:
  * @container: a #GtkContainer
index 81c43342413c5fb22be2a455d6aaf97a25e57fc5..6725a80e25c468900ed7e25964efe3d5013bb85d 100644 (file)
@@ -142,10 +142,6 @@ GDK_AVAILABLE_IN_ALL
 void     gtk_container_propagate_draw   (GtkContainer   *container,
                                         GtkWidget      *child,
                                         cairo_t        *cr);
-GDK_AVAILABLE_IN_3_90
-void      gtk_container_snapshot_child (GtkContainer *container,
-                                        GtkWidget    *child,
-                                        GtkSnapshot  *snapshot);
 
 GDK_AVAILABLE_IN_ALL
 void     gtk_container_set_focus_chain  (GtkContainer   *container,
index 6e6e5846c38d2630dbb3a05643a7c939700fe1cd..389d6ea65581f7ba65b9bf382f9af73b0d65bb3b 100644 (file)
@@ -71,6 +71,7 @@
 #include "gtkfixed.h"
 
 #include "gtkcontainerprivate.h"
+#include "gtkwidgetprivate.h"
 #include "gtkprivate.h"
 #include "gtkintl.h"
 
@@ -531,9 +532,9 @@ gtk_fixed_snapshot (GtkWidget   *widget,
     {
       child = list->data;
 
-      gtk_container_snapshot_child (GTK_CONTAINER (fixed),
-                                    child->widget,
-                                    snapshot);
+      gtk_widget_snapshot_child (widget,
+                                 child->widget,
+                                 snapshot);
     }
 }
 
index 450339b4a96dcaee14ead7d930afd5c034a0ed12..21dceeccdc9b8f4dc697bd7ad5601d5928dd95d1 100644 (file)
@@ -935,7 +935,7 @@ gtk_model_button_render (GtkCssGadget *gadget,
 
   child = gtk_bin_get_child (GTK_BIN (widget));
   if (child)
-    gtk_container_snapshot_child (GTK_CONTAINER (widget), child, snapshot);
+    gtk_widget_snapshot_child (widget, child, snapshot);
 
   return gtk_widget_has_visible_focus (widget);
 }
index 49e921210cea29731625910a26c46b7abcaa1a5d..0afa5cb6c45bcb1d8577473d1c47de53ba90f399 100644 (file)
@@ -2369,9 +2369,9 @@ gtk_notebook_snapshot_stack (GtkCssGadget *gadget,
   GtkNotebookPrivate *priv = notebook->priv;
 
   if (gtk_notebook_has_current_page (notebook))
-    gtk_container_snapshot_child (GTK_CONTAINER (notebook),
-                                  priv->cur_page->child,
-                                  snapshot);
+    gtk_widget_snapshot_child (widget,
+                               priv->cur_page->child,
+                               snapshot);
 
   return FALSE;
 }
@@ -4588,9 +4588,9 @@ snapshot_tab (GtkCssGadget *gadget,
 
   widget = gtk_css_gadget_get_owner (gadget);
 
-  gtk_container_snapshot_child (GTK_CONTAINER (widget),
-                                page->tab_label,
-                                snapshot);
+  gtk_widget_snapshot_child (widget,
+                             page->tab_label,
+                             snapshot);
 
   return gtk_widget_has_visible_focus (widget) &&
          GTK_NOTEBOOK (widget)->priv->cur_page == page;
index cef4a7740a11f1cc0e559c85559d64274f2fe095..4953ca943dafb655289b5764e4faeb254a60a5aa 100644 (file)
@@ -1678,7 +1678,7 @@ gtk_paned_render (GtkCssGadget *gadget,
                                   gdk_window_get_height (priv->child1_window)
                               ),
                               "GtkPanedChild1");
-      gtk_container_snapshot_child (GTK_CONTAINER (widget), priv->child1, snapshot);
+      gtk_widget_snapshot_child (widget, priv->child1, snapshot);
       gtk_snapshot_pop_and_append (snapshot);
     }
 
@@ -1693,7 +1693,7 @@ gtk_paned_render (GtkCssGadget *gadget,
                                   gdk_window_get_height (priv->child2_window)
                               ),
                               "GtkPanedChild2");
-      gtk_container_snapshot_child (GTK_CONTAINER (widget), priv->child2, snapshot);
+      gtk_widget_snapshot_child (widget, priv->child2, snapshot);
       gtk_snapshot_pop_and_append (snapshot);
     }
 
index 48778fb95493aab795eb11b6ecbd130d67ac0229..c848fdb4256a8d271234f7b68069f21bc5de670a 100644 (file)
@@ -1199,7 +1199,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
   child = gtk_bin_get_child (GTK_BIN (widget));
 
   if (child)
-    gtk_container_snapshot_child (GTK_CONTAINER (widget), child, snapshot);
+    gtk_widget_snapshot_child (widget, child, snapshot);
 }
 
 static void
index 351c73540f9f4260c126adac5cfcebff653cad9f..15c3c51e1cc8b35d2a9f6ae71f68e1022c42f93d 100644 (file)
@@ -30,6 +30,7 @@
 #include "gtksettingsprivate.h"
 #include "gtksnapshot.h"
 #include "gtktypebuiltins.h"
+#include "gtkwidgetprivate.h"
 
 #include "fallback-c89.c"
 
@@ -838,7 +839,7 @@ gtk_revealer_snapshot (GtkWidget   *widget,
   transition = effective_transition (revealer);
   if (transition == GTK_REVEALER_TRANSITION_TYPE_NONE)
     {
-      gtk_container_snapshot_child (GTK_CONTAINER (revealer), child, snapshot);
+      gtk_widget_snapshot_child (widget, child, snapshot);
     }
   else
     {
@@ -849,7 +850,7 @@ gtk_revealer_snapshot (GtkWidget   *widget,
                                   gtk_widget_get_allocated_height (widget)
                               ),
                               "RevealerClip");
-      gtk_container_snapshot_child (GTK_CONTAINER (revealer), child, snapshot);
+      gtk_widget_snapshot_child (widget, child, snapshot);
       gtk_snapshot_pop_and_append (snapshot);
     }
 }
index df580192cc16977e81d69dafd5f3911abd09e8b6..a4ecbb529140bb9d3dc1ead1e600aaad1dd225f0 100644 (file)
@@ -1917,9 +1917,9 @@ gtk_stack_snapshot_crossfade (GtkWidget   *widget,
   char *name;
 
   gtk_snapshot_push (snapshot, TRUE, "GtkStackCrossFadeEnd");
-  gtk_container_snapshot_child (GTK_CONTAINER (stack),
-                                priv->visible_child->widget,
-                                snapshot);
+  gtk_widget_snapshot_child (widget,
+                             priv->visible_child->widget,
+                             snapshot);
   end_node = gtk_snapshot_pop (snapshot);
 
   if (priv->last_visible_node)
@@ -1995,9 +1995,9 @@ gtk_stack_snapshot_under (GtkWidget   *widget,
                           &GRAPHENE_RECT_INIT(x, y, width, height),
                           "StackUnder");
 
-  gtk_container_snapshot_child (GTK_CONTAINER (stack),
-                                priv->visible_child->widget,
-                                snapshot);
+  gtk_widget_snapshot_child (widget,
+                             priv->visible_child->widget,
+                             snapshot);
 
   gtk_snapshot_pop_and_append (snapshot);
 
@@ -2073,9 +2073,9 @@ gtk_stack_snapshot_slide (GtkWidget   *widget,
       gtk_snapshot_pop_and_append (snapshot);
      }
 
-  gtk_container_snapshot_child (GTK_CONTAINER (stack),
-                                priv->visible_child->widget,
-                                snapshot);
+  gtk_widget_snapshot_child (widget,
+                             priv->visible_child->widget,
+                             snapshot);
 }
 
 static void
@@ -2151,9 +2151,9 @@ gtk_stack_render (GtkCssGadget *gadget,
           gtk_snapshot_pop_and_append (snapshot);
         }
       else
-        gtk_container_snapshot_child (GTK_CONTAINER (stack),
-                                      priv->visible_child->widget,
-                                      snapshot);
+        gtk_widget_snapshot_child (widget,
+                                   priv->visible_child->widget,
+                                   snapshot);
     }
 
   return FALSE;
index e64359da819d43c6ff501bfccc45593e78488f10..db198b388358b03497abdd56c6dd845bd62b1746 100644 (file)
@@ -838,9 +838,9 @@ gtk_toolbar_render (GtkCssGadget *gadget,
       toolbar_content_snapshot (content, GTK_CONTAINER (widget), snapshot);
     }
   
-  gtk_container_snapshot_child (GTK_CONTAINER (widget),
-                               priv->arrow_button,
-                               snapshot);
+  gtk_widget_snapshot_child (widget,
+                             priv->arrow_button,
+                             snapshot);
 
   return FALSE;
 }
@@ -3156,7 +3156,7 @@ toolbar_content_snapshot (ToolbarContent *content,
   widget = GTK_WIDGET (content->item);
 
   if (widget)
-    gtk_container_snapshot_child (container, widget, snapshot);
+    gtk_widget_snapshot_child (GTK_WIDGET (container), widget, snapshot);
 }
 
 static gboolean
index 7e96e793d638a3433941c808aacb0976488af672..19c60e56c3dda09416eba2abd69d34a7103838cb 100644 (file)
@@ -5409,7 +5409,7 @@ gtk_tree_view_snapshot (GtkWidget   *widget,
     {
       GtkTreeViewChild *child = list->data;
 
-      gtk_container_snapshot_child (GTK_CONTAINER (tree_view), child->widget, snapshot);
+      gtk_widget_snapshot_child (widget, child->widget, snapshot);
     }
 
   gtk_snapshot_pop_and_append (snapshot);
@@ -5464,16 +5464,16 @@ gtk_tree_view_snapshot (GtkWidget   *widget,
       if (gtk_tree_view_column_get_visible (column))
         {
           button = gtk_tree_view_column_get_button (column);
-          gtk_container_snapshot_child (GTK_CONTAINER (tree_view),
-                                        button, snapshot);
+          gtk_widget_snapshot_child (widget,
+                                     button, snapshot);
         }
     }
 
   if (tree_view->priv->drag_window)
     {
       button = gtk_tree_view_column_get_button (tree_view->priv->drag_column);
-      gtk_container_snapshot_child (GTK_CONTAINER (tree_view),
-                                    button, snapshot);
+      gtk_widget_snapshot_child (widget,
+                                 button, snapshot);
     }
 
   gtk_style_context_restore (context);
index e61ea434067e294a1997d23874155d30e86e0ea2..aeebdfe4380d4061aaa131511722f8b70b22ca3d 100644 (file)
@@ -15786,6 +15786,26 @@ gtk_widget_get_translation_to_child (GtkWidget *widget,
   *y_out = y;
 }
 
+/**
+ * gtk_widget_snapshot_child:
+ * @widget: a #GtkWidget
+ * @child: a child of @widget
+ * @snapshot: $GtkSnapshot as passed to the container. In particular, no
+ *   calls to gtk_snapshot_translate_2d() should have been applied by the
+ *   parent.
+ *
+ * When a widget receives a call to the snapshot function, it must send
+ * synthetic #GtkWidget::snapshot calls to all children. This function
+ * provides a convenient way of doing this. A widget, when it receives
+ * a call to its #GtkWidget::snapshot function, calls
+ * gtk_widget_snapshot_child() once for each child, passing in
+ * the @snapshot the widget received.
+ *
+ * gtk_widget_snapshot_child() takes care of translating the origin of
+ * @snapshot, and deciding whether the child needs to be snapshot. It is a
+ * convenient and optimized way of getting the same effect as calling
+ * gtk_widget_snapshot() on the child directly.
+ **/
 void
 gtk_widget_snapshot_child (GtkWidget   *widget,
                            GtkWidget   *child,
index 319c7d76d4ab1b89659e628dbe0dab490b3c6d39..d24661b7050bedaaba17de986fb0447737f093b3 100644 (file)
@@ -1261,6 +1261,10 @@ GtkWidget *             gtk_widget_get_prev_sibling     (GtkWidget *widget);
 GDK_AVAILABLE_IN_3_90
 void                    gtk_widget_set_focus_child      (GtkWidget *widget,
                                                          GtkWidget *child);
+GDK_AVAILABLE_IN_3_90
+void                    gtk_widget_snapshot_child       (GtkWidget   *widget,
+                                                         GtkWidget   *child,
+                                                         GtkSnapshot *snapshot);
 
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkWidget, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkRequisition, gtk_requisition_free)
index d4da81c08e5847b4002bd45afa787cc7127d7a0f..c19dd2a96636e72d1d76a23cbf8aec34f19f3c67 100644 (file)
@@ -304,11 +304,6 @@ void              gtk_widget_forall                        (GtkWidget
                                                             GtkCallback           callback,
                                                             gpointer              user_data);
 
-void              gtk_widget_snapshot_child                (GtkWidget   *widget,
-                                                            GtkWidget   *child,
-                                                            GtkSnapshot *snapshot);
-
-
 /* inline getters */
 
 static inline gboolean
index dbdeb18880ccffc5aa668d85488c247f9290b5d4..5f8e2464cffd4d89f7f60b0fc32585a5b28fb2ea 100644 (file)
@@ -9461,15 +9461,15 @@ gtk_window_snapshot (GtkWidget   *widget,
                                (window_border.top + window_border.bottom + title_height));
 
   if (priv->title_box != NULL)
-    gtk_container_snapshot_child (GTK_CONTAINER (widget), priv->title_box, snapshot);
+    gtk_widget_snapshot_child (widget, priv->title_box, snapshot);
 
   if (gtk_bin_get_child (GTK_BIN (widget)))
-    gtk_container_snapshot_child (GTK_CONTAINER (widget), gtk_bin_get_child (GTK_BIN (widget)), snapshot);
+    gtk_widget_snapshot_child (widget, gtk_bin_get_child (GTK_BIN (widget)), snapshot);
 
   for (l = priv->popovers; l; l = l->next)
     {
       GtkWindowPopover *data = l->data;
-      gtk_container_snapshot_child (GTK_CONTAINER (widget), data->widget, snapshot);
+      gtk_widget_snapshot_child (widget, data->widget, snapshot);
     }
 
   gtk_debug_updates_snapshot (widget, snapshot);